import { developmentUrl } from "../config/env";
import request from "../config/axios";

//表格数据 /role/list
export const rolelist = (data) => request({
    url: `${developmentUrl}/role/list?page=${data.page}&name=${data.name}`,
    method: "GET"
})
// 添加表格数据 /role
export const role = (data) => request({
    url: `${developmentUrl}/role?id=${data.id}&num=${data.num}&deptid=${data.deptid}&pid=${data.pid}&name=${data.name}&tips=${data.tips}`,
    method: "POST"
})
//所在部门 /dept/list
export const deptlist = () => request({
    url: `${developmentUrl}/dept/list`,
    method: "GET"
})
//删除 /role?roleId=3
export const  roleDelete = (data) => request({
    url: `${developmentUrl}/role?roleId=${data.roleId}`,
    method: "DELETE"
})
//权限配置 /menu/menuTreeListByRoleId?roleId=1
export const  menuTreeListByRoleId = (data) => request({
    url: `${developmentUrl}/menu/menuTreeListByRoleId?roleId=${data.roleId}`,
    method: "GET"
})
// 权限配置 提交 /role/savePermisson?roleId=2&permissions=1,4,5,6,7,8,9,10
export const  rolesavePermisson= (data) => request({
    url: `${developmentUrl}/role/savePermisson?roleId=${data.roleId}&permissions=${data.permissions}`,
    method: "POST"
})